//
//  UIBarButtonItem + Extension.swift
//  weiboZY
//
//  Created by 赵勇 on 16/5/11.
//  Copyright © 2016年 赵勇. All rights reserved.
//

import UIKit


extension UIBarButtonItem {
    
    convenience init(title: String, fontSize: CGFloat, target: AnyObject?, action: Selector) {
        self.init()
        // 使用便利构造函数创建buttonitem
        let button = UIButton()
        // 添加点击事件
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        // 设置字体颜色
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.setTitle(title, forState: .Normal)
        button.titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        button.sizeToFit()
        customView = button
        
    }
    
    
}




